home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-02-04 | 3.0 KB | 96 lines | [TEXT/MPS ] |
- ### Parse command line ###
-
- set VERSION "1.0"
-
- set Exit 0 # do not exit on non-zero status
- set KeepOnGoingLog 0
- set OnGoingLogFlag 0
- set OutPutFileFlag 0
- set HelpFlag 1
- set VUOptions ""
- set CMD "{0}"
- unset OutputFileList
-
- for Parm in {"Parameters"} # for each parameter on the command line
- if {HelpFlag}
- set HelpFlag 0
- echo "Processing {CMD} parameters..."
- end
-
- if "{Parm}" =~ /-lo/ # keep ongoing log file
- set KeepOnGoingLog 1 # set flag to keep a continuous log file
- set OnGoingLogFlag 1 # set flag - log file OutputSuffix coming next
- Continue
- else
- if (!{OnGoingLogFlag}) # add parameter onto VU Options
- set VUOptions "{VUOptions} '{Parm}'"
- if "{Parm}" =~ /-o≈/ # output filename is next
- set OutPutFileFlag 1
- Continue
- end
- end
- end
-
- if {OnGoingLogFlag} # Parm is the OutputSuffix for the log file
- if "{Parm}" =~ /-≈/ # bad syntax - no suffix after -lo
- echo "No OutputSuffix was given for the -lo option."
- echo "{CMD} will use ∂"Ful∂" for the compiled output file."
- set OutputSuffix "Ful"
- set VUOptions "{VUOptions} '{Parm}'"
- else
- set OutputSuffix "{Parm}" # set the OutputSuffix
- end
- set OnGoingLogFlag 0 # turn it off
- end
-
- if {OutPutFileFlag} # add the Parm to the output file list
- set OutputFileList "`quote {OutputFileList}` ∂"{Parm}∂""
- set OutPutFileFlag 0
- end
- end
-
- # see if user wanted help on VULogger parameters
- if {HelpFlag}
- echo ""
- echo "#"
- echo "# {CMD} {VERSION} - by David Matzner - SIAC, Apple Computer."
- echo "# based on VULinker by Nick Vaccaro"
- echo "#"
- echo "# Description: {CMD} maintains continuous VU log files by concatenating"
- echo "# the logs for each script run on a target into a single file."
- echo "#"
- echo "# Parameters: {CMD} accepts one more parameter than VU:"
- echo "#"
- echo "# -lo (keep ongoing output files) option. The -lo option creates ongoing"
- echo "# output logs for each target. Ordinarily VU overwrites existing"
- echo "# output files when a script begins. This flag by-passes that "
- echo "# limitation by concatenating the old log to a continuous log file."
- echo "# If the -lo flag is found, {CMD} expects the next parameter to be a"
- echo "# suffix for the name of the continuous log file. Otherwise the "
- echo "# default suffix 'Ful' will be appended to the output filename."
- echo "# An example of the -lo option is:"
- echo "#"
- echo "# {CMD} -t1 '*:TargetName' -s 'HD:MyScript'-o1 'TargetOut' -lo 'FullLog' "
- echo "#"
- echo "# The above command would create a file named ∂"TargetOut.FullLog∂""
- echo "# and will copy the ∂"TargetOut∂" output file to the end of the "
- echo "# ∂"TargetOut.FullLog∂" file."
- echo "#"
- echo ""
- exit 1
- end
-
- #Do it!
- #echo VU {VUOptions}
- VU {VUOptions}
-
- set exitCode `EVALUATE {status}`
- #echo {exitCode}
-
- # catenate the files if ongoing logs are being maintained and VU terminated normally
- if {KeepOnGoingLog} #&& !{exitCode}
- #echo "Catenating files…"
- for outFile in {OutputFileList}
- catenate "{outFile}" >> "{outFile}.{OutputSuffix}"
- end
- end